package com.install.manager;


import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.commons.collections.set.ListOrderedSet;

import com.install.core.manager.CommManager;
import com.install.core.util.UserUtil;

public class LoginManager extends CommManager{
	public LoginManager(){
		super(true);
	}
	public JSONObject login(JSONArray object,UserUtil userUtil){
		JSONObject json=new JSONObject();
		JSONObject params=object.getJSONObject(0);
		ListOrderedSet params1=new ListOrderedSet();
		params1.add(params.getInt("uid"));
		params1.add(params.getString("password"));
		JSONArray result=this.listWithparams("select * from user where uid=? and password=?",params1);
		if(result.size()>0){
			json.element("user", result.getJSONObject(0));
		}
		return json;
	}
}
